/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.cib.fintech.entrustedinvestment.biz.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author zhangqingkun
* @date 2020-10-15
**/
@Entity
@Data
@Table(name="fpss_prod_info_extra")
public class ProdInfoExtra implements Serializable {

    @Id
    @Column(name = "prod_code")
    @ApiModelProperty(value = "产品代码（SAM推送）")
    private String prodCode;

    @Column(name = "prod_name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "产品名称（SAM推送）")
    private String prodName;

    @Column(name = "clear_type")
    @ApiModelProperty(value = "清算速度")
    private String clearType;

    @Column(name = "property")
    @ApiModelProperty(value = "资管计划属性：01集合，04定向，05专户")
    private String property;

    @Column(name = "assert_classify")
    @ApiModelProperty(value = "资产分类 01固定收益类")
    private String assertClassify;

    @Column(name = "info1")
    @ApiModelProperty(value = "暂停交易业务（9926违约退出9931申购撤单9925预约赎回9927实时赎回9920认购9921申购9932赎回撤单9922预约申购9924赎回9930认购撤单默认为空为全部允许000-为全部暂停相当于暂停交易）")
    private String info1;

    @Column(name = "is_issued")
    @ApiModelProperty(value = "是否由金融资产投资公司发行0否1是")
    private Integer isIssued;

    @Column(name = "org_code")
    @ApiModelProperty(value = "资管计划发起人机构编码")
    private String orgCode;

    @Column(name = "register_code")
    @ApiModelProperty(value = "资管计划登记编码")
    private String registerCode;

    @Column(name = "manager")
    @ApiModelProperty(value = "管理人")
    private String manager;

    @Column(name = "trustee")
    @ApiModelProperty(value = "托管人")
    private String trustee;

    @Column(name = "issue_amount")
    @ApiModelProperty(value = "发行金额")
    private BigDecimal issueAmount;

    @Column(name = "invest_to")
    @ApiModelProperty(value = "资金实际投向 20固定收益类、21权益类、22商品及金融衍生品类、23混合类\r\n根据合作业务确定，一般为20固定收益类\r\n")
    private String investTo;

    @Column(name = "fund_application_mode")
    @ApiModelProperty(value = "资金运用方式")
    private String fundApplicationMode;

    @Column(name = "fund_application_industry")
    @ApiModelProperty(value = "资金运用行业")
    private String fundApplicationIndustry;

    @Column(name = "establish_date")
    @ApiModelProperty(value = "资管计划成立日期")
    private String establishDate;

    @Column(name = "expiry_date")
    @ApiModelProperty(value = "资管计划终止日期")
    private String expiryDate;

    @Column(name = "plan_mode")
    @ApiModelProperty(value = "资管计划属性 一般为01集合")
    private String planMode;

    @Column(name = "buy_structure")
    @ApiModelProperty(value = "购买结构01优先02劣后03整体\r\n根据合作业务确定，一般为03整体\r\n")
    private String buyStructure;

    @Column(name = "manage_style")
    @ApiModelProperty(value = "管理方式根据合作业务确定一般为02被动委托管理")
    private String manageStyle;

    @Column(name = "manage_fee")
    @ApiModelProperty(value = "管理费率")
    private BigDecimal manageFee;

    @Column(name = "custodian_fee")
    @ApiModelProperty(value = "托管费率")
    private BigDecimal custodianFee;

    @Column(name = "service_fee")
    @ApiModelProperty(value = "中介服务机构合计费率")
    private BigDecimal serviceFee;

    @Column(name = "other_fee")
    @ApiModelProperty(value = "其他合计费率")
    private BigDecimal otherFee;

    @Column(name = "remark")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "create_time")
    @CreationTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "update_time")
    @UpdateTimestamp
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    @Column(name = "expect_top_yieid")
    @ApiModelProperty(value = "预期最高收益率%")
    private BigDecimal expectTopYieid;

    @Column(name = "expect_min_yieid")
    @ApiModelProperty(value = "预期最低收益率%")
    private BigDecimal expectMinYieid;

    @Column(name = "has_yieid")
    @ApiModelProperty(value = "资管计划属性 一般为01集合")
    private Integer hasYieid;

    public void copy(ProdInfoExtra source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}